<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实验室信息管理系统</title>
</head>
<body>
    <script src="/static/qywx/js/vue.min.js"></script>
    <script src="/static/qywx/js/jquery-1.12.4.min.js"></script>

<!--    <div id="qrCode" class="qr-code" />-->
    <iframe id="qr-code" src="" frameborder="0" scrolling="no" width="300px" height="400px"></iframe>

<script>
    // if (localStorage.getItem('codeUrl') != null) {
    //     document.getElementById('qr-code').src = localStorage.getItem('codeUrl');
    // } else {
        $.ajax({
            url: '/qywx/qrCode',
            contentType: 'application/json;charset=UTF-8',
            type: 'get',
            cache: false,
            dataType: 'json',
            success: function (data) {
                console.log(data);
                if (data.status == '1') {
                    localStorage.setItem('codeUrl', data.codeUrl);
                    document.getElementById('qr-code').src = data.codeUrl;
                } else {
                    alert('二维码生成失败');
                }
            },
            error : function () {
                alert('二维码生成失败');
            }
        });
    // }
</script>
</body>
</html>